package com.tian.arch.base

import androidx.multidex.MultiDexApplication
import com.tian.arch.Foundation
import com.tian.arch.ConfigProvider
import com.tian.arch.GlobalConfig
import com.tian.arch.util.SpUtil

abstract class BaseApplication : MultiDexApplication(), ConfigProvider {

    private lateinit var configuration: GlobalConfig

    protected abstract fun initGlobalConfig(): GlobalConfig

    override fun onCreate() {
        super.onCreate()
        Foundation.init(this)
        configuration = initGlobalConfig()
        SpUtil.init()
        registerActivityLifecycleCallbacks(AcManager.manager)
    }

    override fun createGlobalConfig(): GlobalConfig {
        return this.configuration
    }
}